package io.github.uicdb.et;

import io.github.uicdb.et.block.*;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.flag.FeatureFlagSet;
import net.minecraft.world.flag.FeatureFlags;
import net.minecraft.world.inventory.MenuType;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent;
import net.neoforged.neoforge.common.extensions.IMenuTypeExtension;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;

public class ModMenuAndScreens {
    private static final DeferredRegister<MenuType<?>> MENUS = DeferredRegister.create(Registries.MENU, ElementalTheory.MODID);
    public static final DeferredHolder<MenuType<?>, MenuType<ExtractMenu>> EXTRACT = MENUS.register("extract", () ->
            IMenuTypeExtension.create(ExtractMenu::new));
    public static final DeferredHolder<MenuType<?>, MenuType<ElementMenu>> ELEMENT = MENUS.register("element", () ->
            IMenuTypeExtension.create(ElementMenu::new));
    public static final DeferredHolder<MenuType<?>, MenuType<TurnInMenu>> TURN_IN = MENUS.register("turn_in", () ->
            IMenuTypeExtension.create(TurnInMenu::new));
    public static void init(IEventBus modEventBus) {
        MENUS.register(modEventBus);
    }
    @EventBusSubscriber(modid = ElementalTheory.MODID, bus = EventBusSubscriber.Bus.MOD,value = Dist.CLIENT)
    private static class ScreenBinder{
        @SubscribeEvent
        public static void bind(RegisterMenuScreensEvent event){
            event.register(EXTRACT.get(), ExtractScreen::new);
            event.register(ELEMENT.get(), ElementScreen::new);
            event.register(TURN_IN.get(), TurnInScreen::new);
        }
    }
}
